/**
 * 
 */
package org.grill.clovercash;

import java.util.Comparator;

import org.grill.clovercash.accounts.Split;

public final class SplitComparator implements Comparator<Split> {
	public int compare(Split o1, Split o2) {
		if (o1.reconciled && !o2.reconciled)
			return -1;
		if (o2.reconciled && !o1.reconciled)
			return 1;
		if (o1.trans.date.isBefore(o2.trans.date))
			return -1;
		if (o1.trans.date.isAfter(o2.trans.date))
			return 1;
		return -1*o1.value.compareTo(o2.value);
	}
}